package com.yxkj.railservicer.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathEffect;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by sunyu on 2017/5/4.
 */

public class DashedLine extends View {
    private String namespace ;
    private float startX;
    private float startY;
    private float endX;
    private float endY;
    private Rect mRect;
    Paint paint = new Paint();
    Path path = new Path();
    PathEffect effects = new DashPathEffect(new float[]{10,10,10,10},1);

    public DashedLine(Context context, AttributeSet attrs) {
        super(context, attrs);

    }

    @Override
    protected void onDraw(Canvas canvas) {
        // TODO Auto-generated method stub
        super.onDraw(canvas);

        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.DKGRAY);

        path.moveTo(0, 10);
        path.lineTo(620,10);

        paint.setPathEffect(effects);
        canvas.drawPath(path, paint);
    }
}